/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.support.ohos.designlibdemo.bean;

import ohos.agp.components.element.Element;
import ohos.agp.components.element.ElementScatter;
import ohos.app.Context;

/**
 * ListItemBean类
 */
public class ListItemBean {
    private int avatar;
    private String text;

    /**
     * 构造函数
     *
     * @param avatar 头像
     * @param text   名称
     */
    public ListItemBean(int avatar, String text) {
        this.avatar = avatar;
        this.text = text;
    }

    /**
     * 获取头像
     *
     * @return 头像
     */
    public int getAvatar() {
        return avatar;
    }

    /**
     * 设置头像
     *
     * @param avatar 头像
     */
    public void setAvatar(int avatar) {
        this.avatar = avatar;
    }

    /**
     * 获取名称
     *
     * @return 名称
     */
    public String getText() {
        return text;
    }

    /**
     * 设置名称
     *
     * @param text 名称
     */
    public void setText(String text) {
        this.text = text;
    }

    /**
     * 获取Graphic中的Element
     *
     * @param context 上下文Context
     * @param res     资源Res
     * @return Element
     */
    private static Element getGraphicElement(Context context, int res) {
        return ElementScatter.getInstance(context).parse(res);
    }
}